package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;

public class newForDemo {
    public static void main(String[] args) {
        String[] arr = {"one", "two", "three", "four", "five"};
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]);
        }
        System.out.println();
        for (String s : arr) {
            System.out.print(s);
        }
        System.out.println();

        Collection<String> c = new ArrayList();
        Collections.addAll(c, "one", "two", "three", "four", "five");
        Iterator it = c.iterator();
        while (it.hasNext()) {
            String str = (String) it.next();
            System.out.print(str);
        }
        System.out.println();

        for (String s : c) {
            System.out.print(s);
        }
    }
}
